import request from '@/utils/request';
import {AxiosPromise} from 'axios';
import {IncomeDetailsForm, IncomeDetailsQuery, IncomeDetailsVO} from '@/api/biz/incomeDetails/types';

/**
 * 查询收入明细列表
 * @param query
 * @returns {*}
 */

export const listIncomeDetails = (query?: IncomeDetailsQuery): AxiosPromise<IncomeDetailsVO[]> => {
  return request({
    url: '/biz/incomeDetails/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询收入明细详细
 * @param id
 */
export const getIncomeDetails = (id: string | number): AxiosPromise<IncomeDetailsVO> => {
  return request({
    url: '/biz/incomeDetails/' + id,
    method: 'get'
  });
};

/**
 * 新增收入明细
 * @param data
 */
export const addIncomeDetails = (data: IncomeDetailsForm) => {
  return request({
    url: '/biz/incomeDetails',
    method: 'post',
    data: data
  });
};

/**
 * 修改收入明细
 * @param data
 */
export const updateIncomeDetails = (data: IncomeDetailsForm) => {
  return request({
    url: '/biz/incomeDetails',
    method: 'put',
    data: data
  });
};

/**
 * 删除收入明细
 * @param id
 */
export const delIncomeDetails = (id: string | number | Array<string | number>) => {
  return request({
    url: '/biz/incomeDetails/' + id,
    method: 'delete'
  });
};
